package com.md.tww.mapper;

import com.md.tww.entity.Student;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface StudentMapper {

    @Select("select id stuId, stu_name stuName, stu_age stuAge, stu_gender stuGender from student")
    List<Student> selectAllStudent();

    @Select("select id stuId, stu_name stuName, stu_age stuAge, stu_gender stuGender from student where id = #{id}")
    Student selectStudentById(int id);

    @Update("update student set stu_name = #{stuName} where id = #{stuIc}")
    int updateStudent(Student student);

    @Insert("insert into student (stu_name) values (#{stuName})")
    int insertStudent(Student student);

    @Delete("delete from student where id = #{id}")
    int deleteStudent(int id);
}
